<template>
  <div class="address-edit">
    <van-address-edit
      class="edit"
      :area-list="arealist"
      :address-info="addressInfo"
      :show-delete="types == 'edit'"
      show-set-default
      show-search-result
      :search-result="searchResult"
      :area-columns-placeholder="['请选择', '请选择', '请选择']"
      @save="onSave"
      @delete="onDelete"
    />
  </div>
  
</template>

<script setup>
import {useRoute, useRouter} from 'vue-router'
import useAddress from '@/hooks/useAddress'

const {
  types, addrId, searchResult, addressInfo, arealist,
  onSave, onDelete
} = useAddress(useRoute(), useRouter())
</script>

<style lang="less" scoped>
@import '@/assets/style/var.less';

.edit {
  .van-field__body {
    textarea {
      height: 26px!important;
    }
  }
}
.address-edit {
  .van-address-edit {
    :deep(.van-button--danger) {
      width: 90%;
      margin: 30px auto 0;
      background: @primary;
      border-color: @primary;
    }
    :deep(.van-button--block) {
      width: 90%;
      margin: 30px auto 0;
    }
    .van-switch--on {
      background: @primary;
    }
  }
}
</style>